import Vue from 'vue';
import VueRouter from 'vue-router';
import LoginRegister from '../pages/login-register.vue';
import Main from '../views/Main.vue';

import Home from '../views/home/index.vue';
import Notice from '../views/notices/index.vue';
import Vid from '../views/inspection/vid/index.vue';
import Mon from '../views/inspection/mon/index.vue';
import Data from '../views/data/index.vue';
import Aboutus from '../views/aboutus/index.vue';
import Person from '../views/person/index.vue';
import Setting from '../views/setting/index.vue';

Vue.use(VueRouter);

const routes = [
    { path: '/login', component: LoginRegister, name: 'LoginRegister' },
    {
        path: '/', redirect: '/login',
        component: Main,
        name: 'Main',
        children: [
            {
                path: 'home',
                meta: {
                    id: '1', name: '主页', icon: 'el-icon-s-home',
                    path: '/home'
                },
                component: Home
            },
            {
                path: 'inspection',
                meta: {
                    id: '2', name: '检测', icon: 'el-icon-camera-solid',
                },
                component: { render: (c) => c('router-view') },
                children: [
                    {
                        path: 'vid',
                        meta: {
                            id: '21', name: '视频检测', icon: 'el-icon-video-camera', path: '/inspection/vid'
                        },
                        component: Vid
                    },
                    {
                        path: 'mon',
                        meta: {
                            id: '22', name: '监控检测', icon: 'el-icon-monitor', path: '/inspection/mon'
                        },
                        component: Mon
                    },
                ]
            },
            {
                path: 'data',
                meta: {
                    id: '3', name: '日志', icon: 'el-icon-s-claim',
                    path: '/data'
                },
                component: Data
            },
            {
                path: 'notice',
                meta: {
                    id: '4', name: '厨小圈', icon: 'el-icon-message-solid',
                    path: '/notice'
                },
                component: Notice
            },
        
            {
                path: 'person',
                meta: {
                    id: '5', name: '员工管理', icon: 'el-icon-user-solid',
                    path: '/person'
                },
                component: Person
            },
            {
                path: 'setting',
                meta: {
                    id: '6', name: '个人主页', icon: 'el-icon-user',
                    path: '/setting'
                },
                component: Setting
            },
            {
                path: 'aboutus',
                meta: {
                    id: '7', name: '关于我们', icon: 'el-icon-s-flag',
                    path: '/aboutus'
                },
                component: Aboutus
            },
        ],
    },
    { path: '*', redirect: '/login' },
];

const router = new VueRouter({
    mode: 'history',
    routes
});

export default router;